package top.huhuiyu.myimages.convert;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class MyStringConverter implements Converter<String, String> {

	public static boolean isEmpty(String str) {
		return str == null || str.trim().equals("");
	}

	@Override
	public String convert(String source) {
		// 将null值转换成""，否则返回去空后的字符串
		if (source == null) {
			return "";
		}
		return source.trim();
	}

}
